package net.int0r.gscore.examples;

import java.util.ArrayList;
import java.util.Iterator;

import net.int0r.gscore.connector.SpotConnector;
import net.int0r.gscore.connector.SpotListConnector;
import net.int0r.gscore.connector.TopSpotsConnector;
import net.int0r.gscore.connector.UserConnector;
import net.int0r.gscore.connector.UserStampConnector;
import net.int0r.gscore.gobjects.Spot;
import net.int0r.gscore.gobjects.Stamp;
import net.int0r.gscore.gobjects.User;

public class ConnectorExamples {
	public static void main(String[] args) {
		new ConnectorExamples();
	}
	
	public ConnectorExamples() {
		spotConnector();
		spotListConnector();
		topSpotsConnector();
		userConnector();
		userStampConnector();
	}
	
	public void spotConnector() {
		Spot tmpSpot = SpotConnector.getSpot(18568);
		System.out.println(tmpSpot.getName());
		System.out.println(tmpSpot.getCheckinCount());
	}
	
	public void spotListConnector() {
		ArrayList<Spot> spotList = SpotListConnector.getSpots(30.2697, -97.7494, 50);
		Iterator<Spot> spotIter = spotList.iterator();
		while(spotIter.hasNext()) {
			Spot tmpSpot = spotIter.next();
			System.out.println(tmpSpot.getName());
		}
	}
	
	public void topSpotsConnector() {
		System.out.println(TopSpotsConnector.getTopSpots("gabea"));
	}
	
	public void userConnector() {
		User tmpUser = UserConnector.getUser("gabea");
		System.out.println(tmpUser.getFirstName());
	}
	
	public void userStampConnector() {
		ArrayList<Stamp> userStamps = UserStampConnector.getStampsForUser("gabea", 999);
		Iterator<Stamp> stampIter = userStamps.iterator();
		while(stampIter.hasNext()) {
			Stamp tmpStamp = stampIter.next();
			System.out.println(tmpStamp.getName());
		}
	}
}
